package com.hdax.dm.controller;

import com.hdax.dm.dto.CommonResponse;
import com.hdax.dm.dto.DtoUtil;
import com.hdax.dm.service.SeatListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@RestController
@RequestMapping(path = "/choose")
public class DmSchedulerSeatController {

    @Autowired
    private SeatListService seatListService;

    //剧场座位信息
    @PostMapping(path = "/seat/getSeatList")
    public CommonResponse<Map<String,List<String>>> getSeatList(@RequestBody Map<String,Long> parmas){
        //排期ID
        Long scheduleId = parmas.get("scheduleId");
        Map<String,List<String>> map = new HashMap<>();
        map.put("seatArray",seatListService.getSeatList(scheduleId));
        return DtoUtil.returnSuccess(map);
    }

    //排期座位信息
    @PostMapping(path = "/seat/getSchedule")
    public CommonResponse<Map<String,Object>> getSchedule(@RequestBody Map<String,Long> parmas){
        //排期ID
        Long scheduleId = parmas.get("scheduleId");
        Map<String,Object> map = seatListService.getSchedule(scheduleId);
        map.put("scheduleId",scheduleId);
        map.put("cinemaId",parmas.get("cinemaId"));
        return DtoUtil.returnSuccess(map);
    }
}
